
var express = require('express')

var cookieParser = require('cookie-parser')

var app = express()

app.set('view engine', 'ejs')

app.use(cookieParser('123332'))

app.get('/',function (req, res) {
    var array = req.signedCookies.citys?req.signedCookies.citys:[]
    res.send('您浏览过的城市'+array)
})

app.get('/visit',function (req, res) {
    var city = req.query.city
    var array = req.signedCookies.citys?req.signedCookies.citys:[]
    array.push(city)
    res.cookie('citys',array,{maxAge:60000,path:'/',signed:true})
    res.send('到此一游-----'+city)
})


app.listen(3001)